/*
 * Copyright (C) 2011, EADS France
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 */

package xowl.interpreter.frontends.functional;

import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author Laurent WOUTERS
 */
public abstract class Loader {
    private String input;
    protected Map<String, xowl.lang.owl2.AnonymousIndividual> mapAnonIndividuals;
    
    public String getInput() { return input; }

    public Loader(String input) {
        this.input = input;
        this.mapAnonIndividuals = new HashMap<String, xowl.lang.owl2.AnonymousIndividual>();
    }
    
    public abstract xowl.lang.owl2.IRI getIRI(String fullIRI);
    
    public xowl.lang.owl2.AnonymousIndividual resolveAnonymousIndividual(String id) {
        if (mapAnonIndividuals.containsKey(id))
            return mapAnonIndividuals.get(id);
        xowl.lang.owl2.AnonymousIndividual ind = new xowl.lang.owl2.AnonymousIndividual();
        ind.setNodeID(id);
        mapAnonIndividuals.put(id, ind);
        return ind;
    }
}
